﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.Admin.ViewModels.AnswerEditModels>" %>

<%@ Import Namespace="ChoViet.Lib.Helpers" %>
<%@ Import Namespace="ChoViet.Lib.Paging" %>
<%@ Import Namespace="ChoViet.Admin.ViewModels" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
   Sửa câu Trả lời
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
      <% using (Html.BeginForm("EditAnswer", "Question", FormMethod.Post, new
       {
           id = "adminForm",
       }))
       {%>
    <%= Html.ValidationSummary(true)%>
    <fieldset>
        <legend>Thông tin chi tiết câu hỏi</legend>
        <table class="admintable" width="100%">
            <tbody>
                <tr>
                    <td class="key">
                        Chuyên mục
                    </td>
                    <td>
                        <%= Model.CurrentQuetion.CatID.HasValue ? Model.CurrentQuetion.QuestionCategory.Name : "--"%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tiêu đề
                    </td>
                    <td>
                        <%= Model.CurrentQuetion.Title%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Nội dung
                    </td>
                    <td>
                        <%= Model.CurrentQuetion.QuestionContent%>
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <fieldset>
        <legend>Nội dung câu trả lời</legend>
        <table class="admintable" width="100%">
            <tbody>
                <tr>
                    <td class="key">
                        Nội dung (<font color="red">*</font>)
                    </td>
                    <td>
                        <%=Html.TextAreaFor(m=>m.CurentAnswer.Answers, new { cols = 90, rows = 20 })%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Trạng thái
                    </td>
                    <td>
                    <%if (Model.CurentAnswer.PubYN.Equals(true))
					  { %>
                        <%= Html.RadioButton("PubYN", true, new { @checked = "checked" })%>
                        Đăng
                        <%= Html.RadioButton("PubYN", false)%>
                        Không đăng
                        <%}else{ %>
                         <%= Html.RadioButton("PubYN", true)%>
                        Đăng tin
                        <%= Html.RadioButton("PubYN", false,new { @checked = "checked" })%>
                        Không đăng
                        <% }%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Trạng thái kiểm tra
                    </td>
                    <td>
                    <%if (Model.CurentAnswer.CheckYN.Equals(true))
					  { %>
                        <%= Html.RadioButton("CheckYN", true, new { @checked = "checked" })%>
                        Đã kiểm tra
                        <%= Html.RadioButton("CheckYN", false)%>
                        Chưa kiểm tra
                        <%}
					  else
					  { %>
					  <%= Html.RadioButton("CheckYN", true)%>
                        Đã kiểm tra
                        <%= Html.RadioButton("CheckYN", false , new { @checked = "checked" })%>
                        Chưa kiểm tra
                        <%} %>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                    <%= Html.HiddenFor(m=>m.CurentPage) %>
                    <%=Html.HiddenFor(m=>m.CurrentAnswerID) %>
                        <input type="submit" id="Submit" value="Lưu thay đổi" onclick="return check_extension('ArticleImage','btnSave');" />
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <%}
      } %>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();
        });

        tinyMCE.init({
            mode: "exact",
            elements: "CurentAnswer.Answers",
            theme: "advanced",
            plugins: "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,imagemanager",
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,cleanup,help,code,|,insertdate,inserttime,preview",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });
    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <td>
        <%= Html.Toolbar("Quay lại", "/Question/Details/" + Model.CurrentQuetion.ID, "back") %>
    </td>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
   Sửa câu Trả lời
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
